import request from '@/utils/request'

// 添加收货地址
export const addAddress = (data) => {
  return request({
    url: '/address/add',
    method: 'POST',
    data
  })
}

// 删除收货地址
export const deleteAddress = (aid) => {
  return request({
    url: `/address/delete/${aid}`,
    method: 'DELETE'
  })
}

// 更新收货地址
export const updateAddress = (data) => {
  return request({
    url: '/address/update',
    method: 'PUT',
    data
  })
}

// 根据ID查询收货地址
export const getAddressById = (aid) => {
  return request({
    url: `/address/get/${aid}`,
    method: 'GET'
  })
}

// 查询当前用户的所有收货地址
export const getAddressList = () => {
  return request({
    url: '/address/list',
    method: 'GET'
  })
}